//2009/08/21 00:15:56
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class DerivativeSequence
{
public:
    vector <int> derSeq(vector <int> A, int n)
    {
		vector<int> a(A);
		vector<int> v;
		if(a.size() <= n) return v;
		if(n == 0) return a;
		for(int i=0; i<n; i++)
		{
			v.clear();
			for(int i=0; i<a.size()-1; i++)
			{
				v.push_back(a[i+1]-a[i]);
			}
			a.clear();
			a = v;
		}
		return v;
    }
};
